const path = require('path');
const webpack = require('webpack');

module.exports = {
  entry: './src/index.ts',
  module: {
    rules: [{
      test: /\.tsx?$/,
      use: 'ts-loader',
      exclude: /node_modules/
    }, {
      test: /\.css?$/,
      use: ['style-loader', 'css-loader'],
    }]
  },
  plugins: [
    new webpack.NormalModuleReplacementPlugin(/(.*)environment.dev(\.*)/, function (resource) {
      resource.request = resource.request.replace(/environment.dev/, 'environment.prod');
    })
  ],
  resolve: {
    extensions: ['.ts', '.js']
  },
  mode: 'production',
  output: {
    path: path.resolve(__dirname, '../assets'),
    filename: 'bundle.js',
  }
};
